<?php if($this->form){?>
<div id="edit-user">
    <div class="title"><h3>Thay đổi thông tin cá nhân</h3></div>
    <form action="" method="post" enctype="multipart/form-data">
        <div class="left">
            <div class="input"><?php echo $this->form->user_fullname?></div>
            <div class="input"><?php echo $this->form->user_gender?></div>
            <div class="input"><?php echo $this->form->user_address?></div>
            <div class="input"><?php echo $this->form->user_phone?></div>
            <div class="submit"><?php echo $this->form->edit?>
                    <a href="<?php echo $this->baseUrl('user/changepass')?>" class="re-password" title="Đổi mật khẩu">Đổi mật khẩu</a>
            </div>
           
        </div>
        <div class="right"> 
            <div class="input"><?php echo $this->form->user_image?></div>
        </div>
        
    </form>
    
    <div class="clearb"></div>
</div><!-- end #edit-user -->
<script>

//show image user
    $(function(){
      // createEditor("description");
       
       //create thumb nail
       $("#user_image").change(function(e){
            // get image
            var thisObj = $(this);
            var url = URL.createObjectURL(e.target.files[0]);
            var img = new Image();
            
            var canvas = document.createElement("canvas");
            canvas.setAttribute("class","thumb");
            
            var ctx = canvas.getContext('2d');
            img.onload = function() {
                var h = 140, per = img.width/img.height;
                var w = h*per;
                canvas.height = h;
                canvas.width = w;
                $(".thumb").remove();
                thisObj.parent().append(canvas);
                ctx.drawImage(img, 0, 0,w ,h);    
            }
            img.src = url;   
       })
       <?php if(!empty($this->img)){?>
       $("#product_image").parent()
                  .append("<img class='thumb' src='<?php echo $this->baseUrl("default/images/user/$this->img")?>'/>");
       <?php }?>
    });
</script>

<?php }?>
